package com.inmobi.androidsdk.impl.imai;

import com.inmobi.androidsdk.impl.net.RequestResponseManager;
import com.inmobi.commons.internal.FileOperations;
import com.inmobi.commons.internal.InternalSDKUtil;
import com.inmobi.commons.internal.Log;
import com.inmobi.re.container.IMWebView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;

public class IMAIClickEventList extends ArrayList<IMAIClickEvent>
{
  private static final long serialVersionUID = -211778664111073467L;

  public static IMAIClickEventList getLoggedClickEvents()
  {
    try
    {
      boolean bool = FileOperations.isFileExist(InternalSDKUtil.getContext(), "imai_click_events");
      IMAIClickEventList localIMAIClickEventList = null;
      if (bool)
        localIMAIClickEventList = (IMAIClickEventList)FileOperations.readFromFile(InternalSDKUtil.getContext(), "imai_click_events");
      if (localIMAIClickEventList != null);
      while (true)
      {
        return localIMAIClickEventList;
        localIMAIClickEventList = new IMAIClickEventList();
      }
    }
    finally
    {
    }
  }

  public boolean addClickEvent(String paramString, boolean paramBoolean1, boolean paramBoolean2, WeakReference<IMWebView> paramWeakReference)
  {
    try
    {
      RequestResponseManager.isSynced.set(false);
      add(new IMAIClickEvent(paramString, paramBoolean1, paramBoolean2, paramWeakReference, true, 0));
      return true;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public IMAIClickEvent getClickEvent(int paramInt)
  {
    try
    {
      Iterator localIterator = iterator();
      while (localIterator.hasNext())
      {
        IMAIClickEvent localIMAIClickEvent = (IMAIClickEvent)localIterator.next();
        int i = localIMAIClickEvent.getClickId();
        if (i == paramInt)
          return localIMAIClickEvent;
      }
    }
    catch (Exception localException)
    {
      Log.internal("InMobiAndroidSDK_3.7.0", "Cant get click event", localException);
      return null;
    }
    return null;
  }

  public void reduceRetryCount(int paramInt)
  {
    try
    {
      RequestResponseManager.isSynced.set(false);
      IMAIClickEvent localIMAIClickEvent = getClickEvent(paramInt);
      int i = localIMAIClickEvent.getRetryCount();
      removeClickEvent(paramInt);
      if (i > 1)
      {
        localIMAIClickEvent.setFirstClick(false);
        localIMAIClickEvent.setRetryCount(-1 + localIMAIClickEvent.getRetryCount());
        add(localIMAIClickEvent);
      }
      return;
    }
    catch (Exception localException)
    {
      while (true)
        Log.internal("InMobiAndroidSDK_3.7.0", "Cant reduce retry count", localException);
    }
    finally
    {
    }
  }

  public boolean removeClickEvent(int paramInt)
  {
    try
    {
      RequestResponseManager.isSynced.set(false);
      remove(getClickEvent(paramInt));
      bool = true;
      return bool;
    }
    catch (Exception localException)
    {
      while (true)
      {
        Log.internal("InMobiAndroidSDK_3.7.0", "Cant remove click event", localException);
        boolean bool = false;
      }
    }
    finally
    {
    }
  }

  public void resetFirstClick(int paramInt)
  {
    try
    {
      RequestResponseManager.isSynced.set(false);
      IMAIClickEvent localIMAIClickEvent = getClickEvent(paramInt);
      removeClickEvent(paramInt);
      localIMAIClickEvent.setFirstClick(false);
      add(localIMAIClickEvent);
      return;
    }
    catch (Exception localException)
    {
      while (true)
        Log.internal("InMobiAndroidSDK_3.7.0", "Cant reset first click flag", localException);
    }
    finally
    {
    }
  }

  public void saveClickEvents()
  {
    Log.internal("InMobiAndroidSDK_3.7.0", "Save ping events");
    FileOperations.saveToFile(InternalSDKUtil.getContext(), "imai_click_events", this);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.inmobi.androidsdk.impl.imai.IMAIClickEventList
 * JD-Core Version:    0.6.2
 */